package com.leunpha.mini.spider.n;


import com.leunpha.mini.spider.annotation.Regex;
import com.leunpha.mini.spider.bean.AbstractBean;

/**
 * User: zhoujingjie
 * Date: 14-6-24
 * Time: 下午3:08
 */
public class BaiduBean extends AbstractBean{

    public String id;

    @Regex("appname.*?>(.*?)</")
    public String name;

    @Regex("<span.*?params-catename.*?>(.*?)</")
    public String category;

    @Regex("data-size=\"(.*?)\"")
    public String size;

    @Regex("data-package=\"(.*?)\"")
    public String packageName;

    @Regex("data-versioncode=\"(.*?)\"")
    public String versionCode;

    @Regex("data-versionname=\"(.*?)\"")
    public String versionName;

    @Regex("<span.*?params-platform.*?>(.*?)</span>")
    public String platform;

    @Regex("class=\"brief-des.*?>(.*?)<br")
    public String description;

    @Regex("<h4.*?>编辑评语</h4>.*?<p.*?>(.*?)</p>")
    public String editorRemark;

    @Regex("data-download_url=\"(.*?)\"")
    public String appLink;

    @Regex("data-icon=\"(.*?)\"")
    public String logo;

    @Regex(value = "over-con(.*?)report-btn@@@<img\\s*src=\"(.*?)\"",multiple = true,splitor = "@@@")
    public String images;

    @Override
    public String toString() {
        return "BaiduBean{" +
                "name='" + name + '\'' +
                ", category='" + category + '\'' +
                ", size='" + size + '\'' +
                ", packageName='" + packageName + '\'' +
                ", versionCode='" + versionCode + '\'' +
                ", versionName='" + versionName + '\'' +
                ", platform='" + platform + '\'' +
                ", description='" + description + '\'' +
                ", editorRemark='" + editorRemark + '\'' +
                ", appLink='" + appLink + '\'' +
                ", logo='" + logo + '\'' +
                ", images='" + images + '\'' +
                '}';
    }

    public String getSplitor(){
        return "@@@";
    }


    @Override
    public int hashCode() {
        if(this != null){
            return (packageName+versionCode).hashCode();
        }
        return super.hashCode();
    }
}
